# -*- coding:utf8 -*-
import sync2,time
import ConfigParser
import string, os, sys


while True: 
    try:
         
        #读取配置参数
        cf = ConfigParser.ConfigParser()
        cf.read("config.ini")
        #可以按照类型读取出来
        host = cf.get("parameters", "host").strip()
        port = cf.get("parameters", "port").strip()
        destination = cf.get("parameters", "destination").strip()
        pollingtime = int(cf.get("parameters", "pollingtime").strip())
        user = cf.get("parameters", "user").strip()
        password = cf.get("parameters", "password").strip()
        
        sync2.run(user,destination,port,host,password)
    except Exception,e:
        print e
    print "休息%ss...".decode("utf8").encode("gb2312") %pollingtime
    time.sleep(pollingtime)
